package com.explorati.interview.interview.chaptersix;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 文件拷贝
 * 
 * @author explorati
 *
 */
public class FileCopy {

	public static void main(String[] args) {
		FileInputStream fis = null;
		FileOutputStream fos = null;
		try {
			fis = new FileInputStream("e:/test/a.txt");
			fos = new FileOutputStream("e:/test/test/b.txt");

			byte[] b = new byte[1024];
			int buffer = 0;
			while ((buffer = fis.read(b)) != 0) {
				fos.write(b, 0, buffer);
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {
				fis.close();
				fos.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}

	}
}
